package com.hope.core.time.service;

import java.util.Calendar;
import java.util.Locale;

import javax.jws.WebService;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import org.springframework.format.datetime.DateFormatter;
import org.springframework.stereotype.Service;

@WebService(serviceName = TimeService.SERVICE_NAME, targetNamespace = "http://127.0.0.1/demo/wstime")
@Service("timeService")
public class TimeService {
	public final static String SERVICE_NAME = "timeService";

	@GET
	@Produces("text/plain")
	@Path("/version1")
	public String getDateTime1() {
		DateFormatter formatter = new DateFormatter("dd/MM/yyyy hh:mm:ss");
		return "this is version1:" + formatter.print(Calendar.getInstance().getTime(), Locale.getDefault());
	}

	@GET
	@Produces("text/plain")
	@Path("/version2")
	public String getDateTime2() {
		DateFormatter formatter = new DateFormatter("dd/MM/yyyy hh:mm:ss");
		return "this is version2:" + formatter.print(Calendar.getInstance().getTime(), Locale.getDefault());
	}
}
